<?php

namespace App\Http\Middleware;

use App\Models\AdminUser;
use Closure,Session,Auth,Gate;

class Mobile
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next,$test='')
    {

        if( $request->ajax()){

            //若果没有检测到用户登陆，提示无权限
            if (!Auth::check()) return response('UserNotLogin',403);

        }else{

            if (!Auth::check()){
                dd('weidenglu ');

            }

        }
        return $next($request);

    }
}
